<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="售后单号" prop="saleOrderNumber">
        <el-input
          v-model.trim="queryParams.saleOrderNumber"
          placeholder="请输入售后单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="订单号" prop="orderNumber">
        <el-input
          v-model.trim="queryParams.orderNumber"
          placeholder="请输入订单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button
          :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
          size="mini"
          @click="shouqi"
          >展开/收起</el-button
        >
      </el-form-item>

      <div v-if="isOpen">
        <el-form-item label="商品单号" prop="productNumber">
          <el-input
            v-model.trim="queryParams.productNumber"
            placeholder="请输入商品单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品名称" prop="productName">
          <el-input
            v-model.trim="queryParams.productName"
            placeholder="请输入商品名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品ID" prop="productId">
          <el-input
            v-model.trim="queryParams.productId"
            placeholder="请输入商品ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="应付金额" prop="amountDue">
          <el-input
            v-model.trim="queryParams.amountDue"
            placeholder="请输入应付金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品运费" prop="shippingCost">
          <el-input
            v-model.trim="queryParams.shippingCost"
            placeholder="请输入商品运费"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="支付优惠" prop="paymentDiscount">
          <el-input
            v-model.trim="queryParams.paymentDiscount"
            placeholder="请输入支付优惠"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品税费" prop="productTaxAmount">
          <el-input
            v-model.trim="queryParams.productTaxAmount"
            placeholder="请输入商品税费"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退货件数" prop="returnQuantity">
          <el-input
            v-model.trim="queryParams.returnQuantity"
            placeholder="请输入退货件数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退商品金额" prop="returnAmount">
          <el-input
            v-model.trim="queryParams.returnAmount"
            placeholder="请输入退商品金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退运费金额" prop="returnShippingAmount">
          <el-input
            v-model.trim="queryParams.returnShippingAmount"
            placeholder="请输入退运费金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退支付优惠" prop="discountAmount">
          <el-input
            v-model.trim="queryParams.discountAmount"
            placeholder="请输入退支付优惠"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退税费金额" prop="refundAmount">
          <el-input
            v-model.trim="queryParams.refundAmount"
            placeholder="请输入退税费金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="售后申请时间" prop="saleRequestDate">
          <el-date-picker
            clearable
            v-model="queryParams.saleRequestDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择售后申请时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="退款方式" prop="refundMethod">
          <el-input
            v-model.trim="queryParams.refundMethod"
            placeholder="请输入退款方式"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否已上传退款凭证" prop="isRefundProofUploaded">
          <el-input
            v-model.trim="queryParams.isRefundProofUploaded"
            placeholder="请输入是否已上传退款凭证"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="售后原因" prop="saleReason">
          <el-input
            v-model.trim="queryParams.saleReason"
            placeholder="请输入售后原因"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="售后原因标签" prop="saleReasonTag">
          <el-input
            v-model.trim="queryParams.saleReasonTag"
            placeholder="请输入售后原因标签"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退货物流单号" prop="returnLogisticsNumber">
          <el-input
            v-model.trim="queryParams.returnLogisticsNumber"
            placeholder="请输入退货物流单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退货异常" prop="returnedException">
          <el-input
            v-model.trim="queryParams.returnedException"
            placeholder="请输入退货异常"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="退货发货时间" prop="returnShipmentDate">
          <el-date-picker
            clearable
            v-model="queryParams.returnShipmentDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择退货发货时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="退货物流公司" prop="returnLogisticsCompany">
          <el-input
            v-model.trim="queryParams.returnLogisticsCompany"
            placeholder="请输入退货物流公司"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="自动处理截止时间" prop="autoProcessDeadline">
          <el-date-picker
            clearable
            v-model="queryParams.autoProcessDeadline"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择自动处理截止时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item
          label="同意售后申请时间"
          prop="approvedAfterSalesRequestTime"
        >
          <el-date-picker
            clearable
            v-model="queryParams.approvedAfterSalesRequestTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择同意售后申请时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="商家退款时间" prop="refundTime">
          <el-date-picker
            clearable
            v-model="queryParams.refundTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择商家退款时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="用户到账时间" prop="userAccountingTime">
          <el-date-picker
            clearable
            v-model="queryParams.userAccountingTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择用户到账时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="售后关闭时间" prop="afterSaleCloseTime">
          <el-date-picker
            clearable
            v-model="queryParams.afterSaleCloseTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择售后关闭时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="商家退货地址" prop="retailerReturnAddress">
          <el-input
            v-model.trim="queryParams.retailerReturnAddress"
            placeholder="请输入商家退货地址"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="商家退货联系人姓名"
          prop="retailerReturnContactName"
        >
          <el-input
            v-model.trim="queryParams.retailerReturnContactName"
            placeholder="请输入商家退货联系人姓名"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="商家退货联系人电话"
          prop="retailerReturnContactPhone"
        >
          <el-input
            v-model.trim="queryParams.retailerReturnContactPhone"
            placeholder="请输入商家退货联系人电话"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="纠纷责任方" prop="disputeResponder">
          <el-input
            v-model.trim="queryParams.disputeResponder"
            placeholder="请输入纠纷责任方"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否极速退款" prop="isRapidRefund">
          <el-input
            v-model.trim="queryParams.isRapidRefund"
            placeholder="请输入是否极速退款"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否拒签后退款" prop="isRefundAfterDenial">
          <el-input
            v-model.trim="queryParams.isRefundAfterDenial"
            placeholder="请输入是否拒签后退款"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="发货物流单号" prop="shipmentLogisticNumber">
          <el-input
            v-model.trim="queryParams.shipmentLogisticNumber"
            placeholder="请输入发货物流单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="换货物流单号" prop="replacementShippingLogNumber">
          <el-input
            v-model.trim="queryParams.replacementShippingLogNumber"
            placeholder="请输入换货物流单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="售后完结时间" prop="afterSaleCompletionTime">
          <el-date-picker
            clearable
            v-model="queryParams.afterSaleCompletionTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择售后完结时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="订单备注" prop="orderNotes">
          <el-input
            v-model.trim="queryParams.orderNotes"
            placeholder="请输入订单备注"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="用户售后说明" prop="userAfterSalesExplanation">
          <el-input
            v-model.trim="queryParams.userAfterSalesExplanation"
            placeholder="请输入用户售后说明"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="售后备注" prop="saleNotes">
          <el-input
            v-model.trim="queryParams.saleNotes"
            placeholder="请输入售后备注"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="操作人" prop="operatorName">
          <el-input
            v-model.trim="queryParams.operatorName"
            placeholder="请输入操作人"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="协商记录" prop="negotiationRecord">
          <el-input
            v-model.trim="queryParams.negotiationRecord"
            placeholder="请输入协商记录"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="换货商品信息" prop="returnGoodsInfo">
          <el-input
            v-model.trim="queryParams.returnGoodsInfo"
            placeholder="请输入换货商品信息"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家编码" prop="merchantCode">
          <el-input
            v-model.trim="queryParams.merchantCode"
            placeholder="请输入商家编码"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="门店名称" prop="storeName">
          <el-input
            v-model.trim="queryParams.storeName"
            placeholder="请输入门店名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="逻辑删除" prop="isDelete">
          <el-input
            v-model.trim="queryParams.isDelete"
            placeholder="请输入逻辑删除"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
      </div>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['live:BiDyOrderAftersales:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['live:BiDyOrderAftersales:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['live:BiDyOrderAftersales:remove']"
          >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['live:BiDyOrderAftersales:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <uploadFile
          @handleSuccess="getList"
          :uploadUrl="'/live/BiDyOrderAftersales/importData'"
        />
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="BiDyOrderAftersalesList"
      @selection-change="handleSelectionChange"
      :height="650"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column
        width="200"
        label="售后单号"
        align="center"
        prop="saleOrderNumber"
      />
      <el-table-column
        width="200"
        label="订单号"
        align="center"
        prop="orderNumber"
      />
      <el-table-column
        width="200"
        label="商品单号"
        align="center"
        prop="productNumber"
      />
      <el-table-column
        width="200"
        label="nis售后类型"
        align="center"
        prop="misAfterSaleType"
      />
      <!-- <el-table-column
        width="200"
        label="退货数量"
        align="center"
        prop="returnQuantity"
      /> -->
      <el-table-column
        width="200"
        label="商品名称"
        align="center"
        prop="productName"
      >
      </el-table-column>
      <el-table-column
        width="200"
        label="商品ID"
        align="center"
        prop="productId"
      />
      <el-table-column
        width="200"
        label="应付金额"
        align="center"
        prop="amountDue"
      />
      <el-table-column
        width="200"
        label="商品运费"
        align="center"
        prop="shippingCost"
      />
      <el-table-column
        width="200"
        label="支付优惠"
        align="center"
        prop="paymentDiscount"
      />
      <el-table-column
        width="200"
        label="商品税费"
        align="center"
        prop="productTaxAmount"
      />
      <el-table-column
        width="200"
        label="商品发货状态"
        align="center"
        prop="itemShippingStatus"
      />
      <el-table-column
        width="200"
        label="售后类型"
        align="center"
        prop="afterSaleType"
      />
      <el-table-column
        width="200"
        label="退货件数"
        align="center"
        prop="returnQuantity"
      />
      <el-table-column
        width="200"
        label="退商品金额"
        align="center"
        prop="returnAmount"
      />
      <el-table-column
        width="200"
        label="退运费金额"
        align="center"
        prop="returnShippingAmount"
      />
      <el-table-column
        width="200"
        label="退支付优惠"
        align="center"
        prop="discountAmount"
      />
      <el-table-column
        width="200"
        label="退税费金额"
        align="center"
        prop="refundAmount"
      />
      <el-table-column
        width="200"
        label="售后状态"
        align="center"
        prop="postSaleStatus"
      />
      <el-table-column
        width="200"
        label="售后申请时间"
        align="center"
        prop="saleRequestDate"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.saleRequestDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="退款方式"
        align="center"
        prop="refundMethod"
      />
      <el-table-column
        width="200"
        label="是否已上传退款凭证"
        align="center"
        prop="isRefundProofUploaded"
      />
      <el-table-column
        width="200"
        label="售后原因"
        align="center"
        prop="saleReason"
      />
      <el-table-column
        width="200"
        label="售后原因标签"
        align="center"
        prop="saleReasonTag"
      />
      <el-table-column
        width="200"
        label="退货物流单号"
        align="center"
        prop="returnLogisticsNumber"
      />
      <el-table-column
        width="200"
        label="退货异常"
        align="center"
        prop="returnedException"
      />
      <el-table-column
        width="200"
        label="退货发货时间"
        align="center"
        prop="returnShipmentDate"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.returnShipmentDate, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="退货物流公司"
        align="center"
        prop="returnLogisticsCompany"
      />
      <el-table-column
        width="200"
        label="自动处理截止时间"
        align="center"
        prop="autoProcessDeadline"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.autoProcessDeadline, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="同意售后申请时间"
        align="center"
        prop="approvedAfterSalesRequestTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.approvedAfterSalesRequestTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="商家退款时间"
        align="center"
        prop="refundTime"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.refundTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="用户到账时间"
        align="center"
        prop="userAccountingTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.userAccountingTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="售后关闭时间"
        align="center"
        prop="afterSaleCloseTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.afterSaleCloseTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="商家退货地址"
        align="center"
        prop="retailerReturnAddress"
      />
      <el-table-column
        width="200"
        label="商家退货联系人姓名"
        align="center"
        prop="retailerReturnContactName"
      />
      <el-table-column
        width="200"
        label="商家退货联系人电话"
        align="center"
        prop="retailerReturnContactPhone"
      />
      <el-table-column
        width="200"
        label="仲裁状态"
        align="center"
        prop="arbStatus"
      />
      <el-table-column
        width="200"
        label="纠纷责任方"
        align="center"
        prop="disputeResponder"
      />
      <el-table-column
        width="200"
        label="是否极速退款"
        align="center"
        prop="isRapidRefund"
      />
      <el-table-column
        width="200"
        label="是否拒签后退款"
        align="center"
        prop="isRefundAfterDenial"
      />
      <el-table-column
        width="200"
        label="发货物流单号"
        align="center"
        prop="shipmentLogisticNumber"
      />
      <el-table-column
        width="200"
        label="发货物流状态"
        align="center"
        prop="shippingStatus"
      />
      <el-table-column
        width="200"
        label="换货物流单号"
        align="center"
        prop="replacementShippingLogNumber"
      />
      <el-table-column
        width="200"
        label="退货物流状态"
        align="center"
        prop="returnLogisticStatus"
      />
      <el-table-column
        width="200"
        label="售后完结时间"
        align="center"
        prop="afterSaleCompletionTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.afterSaleCompletionTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="订单备注"
        align="center"
        prop="orderNotes"
      />
      <el-table-column
        width="200"
        label="用户售后说明"
        align="center"
        prop="userAfterSalesExplanation"
      />
      <el-table-column
        width="200"
        label="售后备注"
        align="center"
        prop="saleNotes"
      />
      <el-table-column
        width="200"
        label="操作人"
        align="center"
        prop="operatorName"
      />
      <el-table-column
        width="200"
        label="协商记录"
        align="center"
        prop="negotiationRecord"
      />
      <el-table-column
        width="200"
        label="换货商品信息"
        align="center"
        prop="returnGoodsInfo"
      />
      <el-table-column
        width="200"
        label="商家编码"
        align="center"
        prop="merchantCode"
      />
      <el-table-column
        width="200"
        label="门店名称"
        align="center"
        prop="storeName"
      />
      <!-- <el-table-column
        width="200"
        label="逻辑删除"
        align="center"
        prop="isDelete"
      /> -->
      <el-table-column width="200" label="备注" align="center" prop="remark" />
      <el-table-column
        width="200"
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['live:BiDyOrderAftersales:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['live:BiDyOrderAftersales:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改抖音订单售后对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="售后单号" prop="saleOrderNumber">
          <el-input
            v-model.trim="form.saleOrderNumber"
            placeholder="请输入售后单号"
          />
        </el-form-item>
        <el-form-item label="订单号" prop="orderNumber">
          <el-input
            v-model.trim="form.orderNumber"
            placeholder="请输入订单号"
          />
        </el-form-item>
        <el-form-item label="商品单号" prop="productNumber">
          <el-input
            v-model.trim="form.productNumber"
            placeholder="请输入商品单号"
          />
        </el-form-item>
        <el-form-item label="商品名称" prop="productName">
          <el-input
            v-model.trim="form.productName"
            placeholder="请输入商品名称"
          />
        </el-form-item>
        <el-form-item label="商品ID" prop="productId">
          <el-input v-model.trim="form.productId" placeholder="请输入商品ID" />
        </el-form-item>
        <el-form-item label="应付金额" prop="amountDue">
          <el-input
            v-model.trim="form.amountDue"
            placeholder="请输入应付金额"
          />
        </el-form-item>
        <el-form-item label="商品运费" prop="shippingCost">
          <el-input
            v-model.trim="form.shippingCost"
            placeholder="请输入商品运费"
          />
        </el-form-item>
        <el-form-item label="支付优惠" prop="paymentDiscount">
          <el-input
            v-model.trim="form.paymentDiscount"
            placeholder="请输入支付优惠"
          />
        </el-form-item>
        <el-form-item label="商品税费" prop="productTaxAmount">
          <el-input
            v-model.trim="form.productTaxAmount"
            placeholder="请输入商品税费"
          />
        </el-form-item>
        <el-form-item label="退货件数" prop="returnQuantity">
          <el-input
            v-model.trim="form.returnQuantity"
            placeholder="请输入退货件数"
          />
        </el-form-item>
        <el-form-item label="退商品金额" prop="returnAmount">
          <el-input
            v-model.trim="form.returnAmount"
            placeholder="请输入退商品金额"
          />
        </el-form-item>
        <el-form-item label="退运费金额" prop="returnShippingAmount">
          <el-input
            v-model.trim="form.returnShippingAmount"
            placeholder="请输入退运费金额"
          />
        </el-form-item>
        <el-form-item label="退支付优惠" prop="discountAmount">
          <el-input
            v-model.trim="form.discountAmount"
            placeholder="请输入退支付优惠"
          />
        </el-form-item>
        <el-form-item label="退税费金额" prop="refundAmount">
          <el-input
            v-model.trim="form.refundAmount"
            placeholder="请输入退税费金额"
          />
        </el-form-item>
        <el-form-item label="售后申请时间" prop="saleRequestDate">
          <el-date-picker
            clearable
            v-model="form.saleRequestDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择售后申请时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="退款方式" prop="refundMethod">
          <el-input
            v-model.trim="form.refundMethod"
            placeholder="请输入退款方式"
          />
        </el-form-item>
        <el-form-item label="是否已上传退款凭证" prop="isRefundProofUploaded">
          <el-input
            v-model.trim="form.isRefundProofUploaded"
            placeholder="请输入是否已上传退款凭证"
          />
        </el-form-item>
        <el-form-item label="售后原因" prop="saleReason">
          <el-input
            v-model.trim="form.saleReason"
            placeholder="请输入售后原因"
          />
        </el-form-item>
        <el-form-item label="售后原因标签" prop="saleReasonTag">
          <el-input
            v-model.trim="form.saleReasonTag"
            placeholder="请输入售后原因标签"
          />
        </el-form-item>
        <el-form-item label="退货物流单号" prop="returnLogisticsNumber">
          <el-input
            v-model.trim="form.returnLogisticsNumber"
            placeholder="请输入退货物流单号"
          />
        </el-form-item>
        <el-form-item label="退货异常" prop="returnedException">
          <el-input
            v-model.trim="form.returnedException"
            placeholder="请输入退货异常"
          />
        </el-form-item>
        <el-form-item label="退货发货时间" prop="returnShipmentDate">
          <el-date-picker
            clearable
            v-model="form.returnShipmentDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择退货发货时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="退货物流公司" prop="returnLogisticsCompany">
          <el-input
            v-model.trim="form.returnLogisticsCompany"
            placeholder="请输入退货物流公司"
          />
        </el-form-item>
        <el-form-item label="自动处理截止时间" prop="autoProcessDeadline">
          <el-date-picker
            clearable
            v-model="form.autoProcessDeadline"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择自动处理截止时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item
          label="同意售后申请时间"
          prop="approvedAfterSalesRequestTime"
        >
          <el-date-picker
            clearable
            v-model="form.approvedAfterSalesRequestTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择同意售后申请时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="商家退款时间" prop="refundTime">
          <el-date-picker
            clearable
            v-model="form.refundTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择商家退款时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="用户到账时间" prop="userAccountingTime">
          <el-date-picker
            clearable
            v-model="form.userAccountingTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择用户到账时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="售后关闭时间" prop="afterSaleCloseTime">
          <el-date-picker
            clearable
            v-model="form.afterSaleCloseTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择售后关闭时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="商家退货地址" prop="retailerReturnAddress">
          <el-input
            v-model.trim="form.retailerReturnAddress"
            placeholder="请输入商家退货地址"
          />
        </el-form-item>
        <el-form-item
          label="商家退货联系人姓名"
          prop="retailerReturnContactName"
        >
          <el-input
            v-model.trim="form.retailerReturnContactName"
            placeholder="请输入商家退货联系人姓名"
          />
        </el-form-item>
        <el-form-item
          label="商家退货联系人电话"
          prop="retailerReturnContactPhone"
        >
          <el-input
            v-model.trim="form.retailerReturnContactPhone"
            placeholder="请输入商家退货联系人电话"
          />
        </el-form-item>
        <el-form-item label="纠纷责任方" prop="disputeResponder">
          <el-input
            v-model.trim="form.disputeResponder"
            placeholder="请输入纠纷责任方"
          />
        </el-form-item>
        <el-form-item label="是否极速退款" prop="isRapidRefund">
          <el-input
            v-model.trim="form.isRapidRefund"
            placeholder="请输入是否极速退款"
          />
        </el-form-item>
        <el-form-item label="是否拒签后退款" prop="isRefundAfterDenial">
          <el-input
            v-model.trim="form.isRefundAfterDenial"
            placeholder="请输入是否拒签后退款"
          />
        </el-form-item>
        <el-form-item label="发货物流单号" prop="shipmentLogisticNumber">
          <el-input
            v-model.trim="form.shipmentLogisticNumber"
            placeholder="请输入发货物流单号"
          />
        </el-form-item>
        <el-form-item label="换货物流单号" prop="replacementShippingLogNumber">
          <el-input
            v-model.trim="form.replacementShippingLogNumber"
            placeholder="请输入换货物流单号"
          />
        </el-form-item>
        <el-form-item label="售后完结时间" prop="afterSaleCompletionTime">
          <el-date-picker
            clearable
            v-model="form.afterSaleCompletionTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择售后完结时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="订单备注" prop="orderNotes">
          <el-input
            v-model.trim="form.orderNotes"
            placeholder="请输入订单备注"
          />
        </el-form-item>
        <el-form-item label="用户售后说明" prop="userAfterSalesExplanation">
          <el-input
            v-model.trim="form.userAfterSalesExplanation"
            placeholder="请输入用户售后说明"
          />
        </el-form-item>
        <el-form-item label="售后备注" prop="saleNotes">
          <el-input
            v-model.trim="form.saleNotes"
            placeholder="请输入售后备注"
          />
        </el-form-item>
        <el-form-item label="操作人" prop="operatorName">
          <el-input
            v-model.trim="form.operatorName"
            placeholder="请输入操作人"
          />
        </el-form-item>
        <el-form-item label="协商记录" prop="negotiationRecord">
          <el-input
            v-model.trim="form.negotiationRecord"
            placeholder="请输入协商记录"
          />
        </el-form-item>
        <el-form-item label="换货商品信息" prop="returnGoodsInfo">
          <el-input
            v-model.trim="form.returnGoodsInfo"
            placeholder="请输入换货商品信息"
          />
        </el-form-item>
        <el-form-item label="商家编码" prop="merchantCode">
          <el-input
            v-model.trim="form.merchantCode"
            placeholder="请输入商家编码"
          />
        </el-form-item>
        <el-form-item label="门店名称" prop="storeName">
          <el-input
            v-model.trim="form.storeName"
            placeholder="请输入门店名称"
          />
        </el-form-item>
        <el-form-item label="逻辑删除" prop="isDelete">
          <el-input v-model.trim="form.isDelete" placeholder="请输入逻辑删除" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model.trim="form.remark" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listBiDyOrderAftersales,
  getBiDyOrderAftersales,
  delBiDyOrderAftersales,
  addBiDyOrderAftersales,
  updateBiDyOrderAftersales,
} from "@/api/live/BiDyOrderAftersales";

export default {
  name: "BiDyOrderAftersales",
  data() {
    return {
      isOpen: false,
      inputValue: "",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 抖音订单售后表格数据
      BiDyOrderAftersalesList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        saleOrderNumber: null,
        orderNumber: null,
        productNumber: null,
        productName: null,
        productId: null,
        amountDue: null,
        shippingCost: null,
        paymentDiscount: null,
        productTaxAmount: null,
        itemShippingStatus: null,
        afterSaleType: null,
        returnQuantity: null,
        returnAmount: null,
        returnShippingAmount: null,
        discountAmount: null,
        refundAmount: null,
        postSaleStatus: null,
        saleRequestDate: null,
        refundMethod: null,
        isRefundProofUploaded: null,
        saleReason: null,
        saleReasonTag: null,
        returnLogisticsNumber: null,
        returnedException: null,
        returnShipmentDate: null,
        returnLogisticsCompany: null,
        autoProcessDeadline: null,
        approvedAfterSalesRequestTime: null,
        refundTime: null,
        userAccountingTime: null,
        afterSaleCloseTime: null,
        retailerReturnAddress: null,
        retailerReturnContactName: null,
        retailerReturnContactPhone: null,
        arbStatus: null,
        disputeResponder: null,
        isRapidRefund: null,
        isRefundAfterDenial: null,
        shipmentLogisticNumber: null,
        shippingStatus: null,
        replacementShippingLogNumber: null,
        returnLogisticStatus: null,
        afterSaleCompletionTime: null,
        orderNotes: null,
        userAfterSalesExplanation: null,
        saleNotes: null,
        operatorName: null,
        negotiationRecord: null,
        returnGoodsInfo: null,
        merchantCode: null,
        storeName: null,
        isDelete: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    shouqi() {
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    /** 查询抖音订单售后列表 */
    getList() {
      this.loading = true;
      listBiDyOrderAftersales(this.queryParams).then((response) => {
        this.BiDyOrderAftersalesList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        saleOrderNumber: null,
        orderNumber: null,
        productNumber: null,
        productName: null,
        productId: null,
        amountDue: null,
        shippingCost: null,
        paymentDiscount: null,
        productTaxAmount: null,
        itemShippingStatus: null,
        afterSaleType: null,
        returnQuantity: null,
        returnAmount: null,
        returnShippingAmount: null,
        discountAmount: null,
        refundAmount: null,
        postSaleStatus: null,
        saleRequestDate: null,
        refundMethod: null,
        isRefundProofUploaded: null,
        saleReason: null,
        saleReasonTag: null,
        returnLogisticsNumber: null,
        returnedException: null,
        returnShipmentDate: null,
        returnLogisticsCompany: null,
        autoProcessDeadline: null,
        approvedAfterSalesRequestTime: null,
        refundTime: null,
        userAccountingTime: null,
        afterSaleCloseTime: null,
        retailerReturnAddress: null,
        retailerReturnContactName: null,
        retailerReturnContactPhone: null,
        arbStatus: null,
        disputeResponder: null,
        isRapidRefund: null,
        isRefundAfterDenial: null,
        shipmentLogisticNumber: null,
        shippingStatus: null,
        replacementShippingLogNumber: null,
        returnLogisticStatus: null,
        afterSaleCompletionTime: null,
        orderNotes: null,
        userAfterSalesExplanation: null,
        saleNotes: null,
        operatorName: null,
        negotiationRecord: null,
        returnGoodsInfo: null,
        merchantCode: null,
        storeName: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDelete: null,
        remark: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加抖音订单售后";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getBiDyOrderAftersales(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改抖音订单售后";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateBiDyOrderAftersales(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBiDyOrderAftersales(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除抖音订单售后编号为"' + ids + '"的数据项？')
        .then(function () {
          return delBiDyOrderAftersales(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "live/BiDyOrderAftersales/export",
        {
          ...this.queryParams,
        },
        `BiDyOrderAftersales_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
